]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell-app: Base running state on "interesting" windows
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 22 Jan 2014 16:51:25 +0000 (11:51 -0500)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 22 Jan 2014 21:16:03 +0000 (22:16 +0100)
An app should be considered running if it has at least one "interesting"
window, however the code considers an app running if it has at least
one tracked window. This was fine while we were only tracking interesting
windows, but since commit d21aa0d85fc325 this is no longer the case.
So keep track of the number of interesting windows as well and use that
to determine the running state.

https://bugzilla.gnome.org/show_bug.cgi?id=722690

src/shell-app.c

index 27f56af0692c0a8962af0da82f8e37134161c3b3..83b96c1449c7137e0de6142bbb64cce401e3aef2 100644 (file)
@@ -42,6 +42,8 @@ typedef struct {
 
   GSList *windows;
 
+  guint interesting_windows;
+
   /* Whether or not we need to resort the windows; this is done on demand */
   guint window_sort_stale : 1;
 
@@ -1024,7 +1026,11 @@ _shell_app_add_window (ShellApp        *app,
   shell_app_update_app_menu (app, window);
   shell_app_ensure_busy_watch (app);
 
-  if (app->state != SHELL_APP_STATE_STARTING)
+  if (shell_window_tracker_is_window_interesting (window))
+    app->running_state->interesting_windows++;
+
+  if (app->state != SHELL_APP_STATE_STARTING &&
+      app->running_state->interesting_windows > 0)
     shell_app_state_transition (app, SHELL_APP_STATE_RUNNING);
 
   g_object_thaw_notify (G_OBJECT (app));
@@ -1046,7 +1052,10 @@ _shell_app_remove_window (ShellApp   *app,
   g_object_unref (window);
   app->running_state->windows = g_slist_remove (app->running_state->windows, window);
 
-  if (app->running_state->windows == NULL)
+  if (shell_window_tracker_is_window_interesting (window))
+    app->running_state->interesting_windows--;
+
+  if (app->running_state->interesting_windows == 0)
     shell_app_state_transition (app, SHELL_APP_STATE_STOPPED);
 
   g_signal_emit (app, shell_app_signals[WINDOWS_CHANGED], 0);